<?php
/* -----------------------------------------------------------------
 *                        Aveghe My Blog
 * -----------------------------------------------------------------
 * Aveghe My Blog: made your blog easy!
 * Copyright (C) 2008 Elia Contini
 * 
 * Aveghe My Blog is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * Aveghe My Blog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */

class Aveghe_View_Helper_CommentForm
	{
		public function commentForm($fileID, $reports, $validationResult)
			{
				$result  = "\r\t<form id=\"commentForm\" action=\"".BASE_URL."/post/add-comment\" method=\"post\">\n";
				$result .= "\t\t<fieldset>\n";
				$result .= "\t\t\t<legend><a name=\"commentForm\"></a>Commenta il post</legend>\n";
				$result .= "\t\t\t<input type=\"hidden\" name=\"fileID\" id=\"fileID\" value=\"$fileID\" />\n\n";
				
				// report
				if(count($reports) > 0)
					{
						$result .= "\n<div id=\"report\">\n\t";
						for($i = 0; $i < count($reports); $i++)
							$result .= "\n\t".$reports[$i]."\n";
						$result .= "\n</div>\n";
					}
				
				$result .= "\t\t\t<label for=\"author\">Nome (obbligatorio)</label>\n";
				$result .= "\t\t\t<input class=\"text\" type=\"text\" name=\"author\" id=\"author\" value=\"".$validationResult['author']."\"/>\n<br />\n";
					
				$result .= "\t\t\t<label for=\"author_email\">Indirizzo e-mail (obbligatorio, non verr&agrave; pubblicato)</label>\n";
				$result .= "\t\t\t<input class=\"text\" type=\"text\" name=\"author_email\" id=\"author_email\" value=\"".$validationResult['author_email']."\" />\n<br />\n";
				
				$result .= "\t\t\t<label for=\"author_website\">Sito Web</label>\n";
				$result .= "\t\t\t<input class=\"text\" type=\"text\" name=\"author_website\" id=\"author_website\" value=\"".$validationResult['author_website']."\" />\n<br />\n";
				
				$result .= "\t\t\t<label for=\"comment_text\">Commento</label>\n";
				$result .= "\t\t\t<textarea  rows=\"10\" cols=\"50\" name=\"comment_text\" id=\"comment_text\">".$validationResult['comment_text']."</textarea>\n<br />\n";
				
				$result .= "\t\t\t<input class=\"submit\" type=\"submit\" value=\"Invia commento\" />\n";
				$result .= "\t\t</fieldset>\n";
				$result .= "\t</form>\n\n";
					
				return $result;
			}
	}
?>